<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <base href="<?= base_url() ?>"/>
        <title>乐天！ &raquo; 首页</title>
        <meta name="generator" content="Order 1.0" /> 
        <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
        <link rel="stylesheet" href="css/style.css" type="text/css" />
        <link rel="stylesheet" href="css/uploadify.css" type="text/css" />
        <link rel="stylesheet" href="jquery-ui/css/ui-lightness/jquery-ui-1.9.0.custom.min.css" />
        <script src="jquery-ui/js/jquery-1.8.2.js" type="text/javascript" charset="utf-8"></script>
        <script src="jquery-ui/js/jquery-ui-1.9.0.custom.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/jquery.uploadify.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
        <script>
            $(function() {  
    
             $("#flex1").flexigrid
            (
            {
            url: '<?php echo site_url('/order/commodity_list');?>',
            dataType: 'json',
            colModel : [
                {display: '商品编号', name : 'id', width : 40, sortable : true, align: 'center'},
                {display: 'ISO', name : 'iso', width : 40, sortable : true, align: 'center'},
                {display: 'Name', name : 'name', width : 180, sortable : true, align: 'left'},
                {display: 'Printable Name', name : 'printable_name', width : 120, sortable : true, align: 'left'},
                {display: 'ISO3', name : 'iso3', width : 130, sortable : true, align: 'left', hide: true},
                {display: 'Number Code', name : 'numcode', width : 80, sortable : true, align: 'right'}
                ],
            buttons : [
                {name: 'Add', bclass: 'add', onpress : test},
                {name: 'Delete', bclass: 'delete', onpress : test},
                {separator: true}

                ],
            searchitems : [
                {display: 'ISO', name : 'iso'},
                {display: 'Name', name : 'name', isdefault: true}
                ],
            sortname: "id",
            sortorder: "asc",
            usepager: true,
            title: '商品表',
            useRp: true,
            rp: 10,
            showTableToggleBtn: true,
            width: 840,
            height: 400
            }
            );   
    
});
function sortAlpha(com)
            { 
            jQuery('#flex1').flexOptions({newp:1, params:[{name:'letter_pressed', value: com},{name:'qtype',value:$('select[name=qtype]').val()}]});
            jQuery("#flex1").flexReload(); 
            }

function test(com,grid)
{
    if (com=='Delete')
        {
           if($('.trSelected',grid).length>0){
           if(confirm('Delete ' + $('.trSelected',grid).length + ' items?')){
            var items = $('.trSelected',grid);
            var itemlist ='';
            for(i=0;i<items.length;i++){
                itemlist+= items[i].id.substr(3)+",";
            }
            $.ajax({
               type: "POST",
               dataType: "json",
               url: "delete.php",
               data: "items="+itemlist,
               success: function(data){
                alert("Query: "+data.query+" - Total affected rows: "+data.total);
               $("#flex1").flexReload();
               }
             });
            }
            } else {
                return false;
            } 
        }
    else if (com=='Add')
        {
            alert('Add New Item Action');
           
        }            
} 
        </script>
        <style>
            .search_bnt {
                height: 32px;
                font-weight:bold;
                font-size:13px;
                width: 100%;
                background: #7FA448;
                margin: 0;
                border: none;
                cursor: pointer;
                color: white;
            }
            .search_bnt:hover{
                background: #8cb352;
            }
            #main{
                margin:10px auto;
                width: 840px;
                height: 350px;
                background: url(images/bg.jpg) no-repeat;
            }
            #left_side{
                float: left;
            }
            #right_side{
                float: right;
                width: 238px;
                background: #EBF2FA;
                border: 1px solid #D4D4D4;
                border-bottom-color: #AAA;
                border-top: none;
                height: 350px;
                box-shadow: 0 1px 1px #CCC;
                margin-top: -2px;
                position: relative;
            }

            #login_div{
                color: #333;
                padding:35px 15px 15px 25px;
                width: 190px;
            }
            #login_div .top, #login_div .pwd{
                background-size: auto;
                color: #333;
                display: block;
                font-size: 12px;
                height: 36px;
                line-height: 20px;
                position: relative;
                width: 190px;
            }
            #login_div dl{
                margin: 15px 0 0 0 ;
            }
            #login_div dd{
                background-attachment: scroll;
                background-color: white;
                background-image: url(images/bg.png) 0 -76px no-repeat;
                border-color: #ADB6C9;
                border-radius: 3px;
                border-style: solid;
                border-width: 1px;
                box-shadow: white 0px 0px 1px 0px;
                color: #333;
                display: block;
                font-size: 12px;
                height: 32px;
                line-height: 20px;
                padding: 1px;
                position: relative;
                width: 186px;
            }
            #login_div .top dt, .pwd dt{
                background-attachment: scroll;
                background: url(images/ico.png) 8px -84px no-repeat;
                display: block;
                height: 25px;
                left: 4px;
                line-height: 20px;
                position: absolute;
                text-indent: -119988px;
                top: 4px;
                width: 25px;
                z-index: 2;
            }
            #login_div .pwd dt{
                background: url(images/ico.png) 8px -112px no-repeat;
            }
            #login_div input[type="text"],input[type="password"]{
                background-attachment: scroll;
                display: inline-block;
                font-size: 14px;
                height: 32px;
                line-height: 32px;
                margin: 0 0 0 30px;
                text-align: start;
                text-indent: 0px;
                text-shadow: none;
                padding: 0;
                border: 0;
                width: 155px;
            }
            #login_div .bottom{
                margin-top: 30px;
            }
            #login_div .header{
                background: url(images/logo.gif) 0 -64px no-repeat;
                height: 55px;
            }
            #login_div #login{
                background-color: transparent;
                background-image: url(images/btn.png);
                background-origin: padding-box;
                background-size: auto;
                cursor: pointer;
                display: inline-block;
                font-size: 12px;
                height: 38px;
                text-align: center;
                text-indent: -119988px;
                width: 190px;
                border:0;
                padding:0 0 3px 0;
                word-spacing: 0px;
            }
        </style>
    </head>
    <body>
        <div id="container">
            <div id="header">
                <div id="header-inner">
                    <h1><span><a href="#">乐天！</a></span></h1>
                    <h2>订单管理系统</h2>
                    <div class="clear"></div>
                    <ul class="sw_menu">
                        <li ><a href=<?php echo site_url('login')?> class="sw_menu_current">首页</a></li>
                        <li><a href=<?php echo site_url('order')?> >管理</a></li>
                        <li><a href=# >筛选</a></li>
                    </ul>
                    <div style="position:absolute;top:87px;right:0px;">
                        <?php
                        if (!empty($uid)) {
                            echo '欢迎：'.$uid;
                            echo '&nbsp&nbsp';
                            echo anchor('login/logout', '&nbsp登出', 'title="News title"');
                         }
                         ?>
                        </div>
                    </div>
                </div>
                <div id="main">
                    <table id="flex1" style="display:none"></table>
                </div>
            </div>
            <div class="clear"> </div>
            <div id="footer">
                <hr />
                <ul>
                    <li>
                        Powered by <a href=#>zju</a>
                    </li>
                </ul>
            </div>
        </div>
    </body>
</html>